package com.cn.medicalcare.customtool;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class IOTool {

    /**
     * 文件增强读写
     * @param is    输入流
     * @param os    输出流
     * @throws IOException
     */
    public static void BufferIO(InputStream is, OutputStream os) throws IOException {
        try {
            byte[] buf = new byte[1024 * 1024];
            int len = 0;
            while ((len = is.read(buf)) != -1) {
                os.write(buf, 0, len);
            }
        } catch (IOException e) {
            throw e;
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) {

                }
            }
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {

                }
            }
        }
    }
}
